<template>
  <div class="analysis-item">
    <div class="file-item">
      <div class="file-upload-item" role="button" v-if="!isLoaded" @click="$emit('upload-click')">
        <slot name="file-upload"></slot>
        <p><slot name="file-upload-tip"></slot></p>
      </div>
      <div class="file-text-item" v-else>
        <slot name="file-text"></slot>
      </div>
    </div>

    <div class="dify-output-item">
      <slot name="dify"></slot>
    </div>
  </div>
</template>

<script>
export default {
  name: 'AnalysisItem',
  props: {
    isLoaded: {
      type: Boolean,
      default: false,
    }
  },
}
</script>

<style>
.analysis-item {
  display: flex;
  width: 100%;
  height: 750px;
}

.file-item {
  width: 45%;
  background-color: var(--vt-c-white-soft);
  border-radius: 8px;
  margin: 20px auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  border: 2px dashed var(--vt-c-black);
}

.file-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  background-color: var(--vt-c-white-mute);
}

.file-upload-item {
  display: flex;
  width: 100%;
  height: 100%;
  justify-content: center;
  align-items: center;
}

.file-upload-item p {
  text-align: center;
  font-size: 18px;
}

.file-text-item  {
  width: 100%;
  height: 100%;
  overflow: scroll;
  overflow-x: hidden;
}


.dify-output-item {
  width: 45%;
  background-color: var(--vt-c-white-mute);
  border-radius: 5px;
  padding: 20px;
  margin: 20px auto;
  margin-bottom: 20px;
  overflow-y: auto;
}

.dify-output-item table {
  border-collapse: collapse;
}

.dify-output-item th,td{
    border: 1px solid var(--vt-c-black);
    text-align: center;
    padding: 20px 0;
}

.dify-output-item table thead tr{
    background-color: var(--vt-c-white-mute);
}

.dify-output-item table tbody tr td:first-child{
    width: 10%;
}

.dify-output-item table tbody tr td:nth-child(2){
    text-align: left;
    padding: 0 20px;
}

.dify-output-item table tbody tr td:last-child{
    width: 10%;
}

.dify-output-item table tfoot tr td{
    text-align: right;
    padding-right: 20px;
}

</style>